package site.shihuan.helpdesk.common.util;

import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.RandomUtil;

/**
 * IdWorker Based on Snowflake.
 *
 * @author 周世焕
 * @Date 2021/1/16 19:55
 */
public class IdWorker {

    public static Snowflake snowflake = IdUtil.createSnowflake(RandomUtil.randomLong(31),RandomUtil.randomLong(31));

    public static String unamePrefix = "用户_";

    public static String nextId() {
        return String.valueOf(snowflake.nextId());
    }

    public static String nextUsername(String uid){
        return unamePrefix + uid;
    }
}
